//package com.yzf.enterprise.framework.config.shardingjdbc;
//
//import com.yzf.enterprise.common.utils.DateUtils;
//import io.shardingsphere.api.algorithm.sharding.PreciseShardingValue;
//import io.shardingsphere.api.algorithm.sharding.standard.PreciseShardingAlgorithm;
//import lombok.extern.slf4j.Slf4j;
//
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.Collection;
//import java.util.Date;
//
///**
// * 等值查询使用的分片算法，包括in
// */
//@Slf4j
//public class TblPreShardAlgo implements PreciseShardingAlgorithm<String> {
//
//    public static final String regex = "-";
//
//    @Override
//    public String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<String> shardingColumn) {
//        log.info("This is Table PreciseShardingAlgorithm , availableTargetNames:" + availableTargetNames);
//        // 按账期的月份来分表
//        String zqStr = shardingColumn.getValue();
//        String[] zqArr = zqStr.split(regex);
//        String monthStr = zqArr[1];
//        Integer month = Integer.parseInt(monthStr);
//        log.info("This is Table PreciseShardingAlgorithm , shard column is:"+zqStr);
//        for (String tableName : availableTargetNames) {
//            if (tableName.endsWith("_"+month)) {
//                return tableName;
//            }
//        }
//        throw new IllegalArgumentException();
//    }
//}